package com.dxy.md.controller;

import com.dxy.md.model.po.StudentPO;
import com.dxy.md.service.MessageService;
import com.dxy.md.service.StudentService;
import com.dxy.md.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {

    @Autowired
    private UserService userService;

    @Autowired
    private MessageService messageService;

    @Autowired
    private StudentService studentService;

    @GetMapping("/findUserById/{id}")
    public Object findUserById(@PathVariable("id")Integer id) {
        return userService.findUserById(id);
    }

    @GetMapping("/findMessageById/{id}")
    public Object findMessageById(@PathVariable("id") String id) {
        return messageService.findMessageById(id);
    }

    @GetMapping("/saveStudent")
    public Object saveStudent(String name, int age) {
        studentService.saveStudent(name, age);
        return "ok";
    }
}
